how to get last element of list in python

28

some_list = [1, 2, 3]
some_list[-1]
print(some_list)
#Output = 3
lst = [2, 5 , 6, 3, 8, 9]
n = len(lst) #get the length
last_el = lst[n-1] #get the last element
print("The last element of the list is:", last_el)

Comments

Submit
0 Comments